'use strict';

const Controller = require('egg').Controller;


//解析用户的输入，处理后返回相应的结果

class HomeController extends Controller {
    async index() {
        const { ctx } = this;
        ctx.body = 'hi, egg';
    }
    async getList(){
        let {ctx,app} = this;
        let {pagenum=1,limit=2} = ctx.query;
        let startIndex = (pagenum-1)*limit;
        let list = await app.mysql.query(`select phone from userlist limit ${startIndex},${limit}`);
        ctx.body = {
            code:1,
            data:list
        }
    }
}

module.exports = HomeController;
